import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, Generated, OneToMany, Index, UpdateDateColumn } from "typeorm";
import { Tags } from "./tags.entity";

@Entity()
export class User {
      @Column({type: "varchar", length: 100})
      name: string;

      @Column({type: "varchar", length: 100, default: "123456"})
      password: string;
      
      @Index()
      @Column()
      email: string;

      @Column({type: "varchar", length: 255})
      desc: string;

      @PrimaryGeneratedColumn()
      id: number;
      
      @OneToMany(()=>Tags,(tags)=> tags.user) //(tags)=>tags.user反向字段
      tags:Tags[];

      @CreateDateColumn({type: "timestamp"})//时间戳 创建时间
      createTime: Date;
      
      @UpdateDateColumn({type: "timestamp"})//时间戳 更新时间
      updateTime: Date;
}
